package vip.liux.front.adapter.controller.payment;

import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;
import vip.liux.front.application.service.payment.PaymentRequestCreateDto;
import vip.liux.front.application.service.payment.PaymentRequestWithDetailsDto;
import vip.liux.front.application.serviceimpl.paymeny.PaymentRequestAppService;

@RestController
@RequestMapping("/api/payment")
public class PaymentController {

    private final PaymentRequestAppService paymentRequestAppService;

    public PaymentController(PaymentRequestAppService paymentRequestAppService) {
        this.paymentRequestAppService = paymentRequestAppService;
    }

    @PostMapping("/request")
    public PaymentRequestWithDetailsDto create(@RequestBody @Valid PaymentRequestCreateDto input) {
        return paymentRequestAppService.create(input);
    }

    @GetMapping("/detail/{id}")
    public PaymentRequestWithDetailsDto details(@PathVariable String id) {
        return paymentRequestAppService.get(id);
    }
}
